package org.jflame.fx.assets;

import java.net.URL;
import java.text.MessageFormat;
import java.util.ResourceBundle;

public final class JFLResources {

    private static String BASE_NAME = "jfl_lang";

    private JFLResources() {
    }

    public static URL load(String path) {
        return JFLResources.class.getResource(path);
    }

    public static String getString(String key) {
        return ResourceBundle.getBundle(BASE_NAME)
                .getString(key);
    }

    public static String getString(String key, Object... args) {
        String pattern = ResourceBundle.getBundle(BASE_NAME)
                .getString(key);
        if (pattern != null) {
            return MessageFormat.format(pattern, args);
        }
        return key;
    }
}
